﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class QuanTri_TrangNhatKyTacVu : System.Web.UI.Page
{
    SoLienLacDataContext db = new SoLienLacDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadGridTacVuAd();
            LoadGridTacVuGV();
          
        }
    }

    private void LoadComboLoaiTacVu()
    {
        //drTacVu.Items.Add("Cập nhật điểm");
        //drTacVu.Items.Add("Cập nhật học sinh");
        //drTacVu.Items.Add("Cập nhật lỗi vi phạm");
        //drTacVu.Items.Add("Cập nhật hạnh kiểm");
    }
    protected void drNamHoc_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
   
    void LoadGridTacVuGV()
    {
        var c = from p in db.TacVus
                select new { p.NoiDung, p.NgayThang, p.TenTacVu,p.CanBoGiaoVien.TenCanBo,p.MaCanBoGV };
        grvTacVuGV.DataSource = c;
        grvTacVuGV.DataBind();
    }
    void LoadGridTacVuAd()
    {
        var c = from p in db.TacVuQuanTris
                select new { p.NoiDung, p.NgayThang, p.TenTacVu, p.Admin.TenDangNhap,p.Admin.TenAdmin};
        grvTacVuAd.DataSource = c;
        grvTacVuAd.DataBind();
    }
   
    protected void btnTim_Click(object sender, EventArgs e)
    {

        LoadGridTacVuGV();
    }

    void CreateTreeView()
    {
        try
        {
            var c = from p in db.TacVus select new { p.MaCanBoGV, p.CanBoGiaoVien.TenCanBo };
            TreeView tree = new TreeView();

            foreach (var con in c)
            {
                TreeNode parent = new TreeNode();
                parent.Text = con.TenCanBo;
                //parent.Expanded = true;
                parent.Value = con.MaCanBoGV;
                tree.Nodes.Add(parent);
                
            }
            //tree.ShowLines = true;
            //tree.
           
         }
        catch
        {
 
        }
    }
    protected void grvCanBo_SelectedIndexChanged(object sender, EventArgs e)
    {
       
    }
    protected void btnTimAd_Click(object sender, EventArgs e)
    {
        
    }
    protected void btnAllGV_Click(object sender, EventArgs e)
    {
        LoadGridTacVuGV();
    }
    protected void btnAllAdmin_Click(object sender, EventArgs e)
    {
        LoadGridTacVuAd();
    }
    protected void btnTimGiaoVien_Click(object sender, EventArgs e)
    {

    }
}